/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package test1.library.command;

import java.io.*;

/**
 *
 * @author admin
 */
public class addbooks implements ICommand {
    	private static final String ADD = "Добавить";
	
	private static final String INFO = "Добавить книгу в библиотеку";
	
	public String name() {
		return ADD;
	}

	
	public String info() {
		return INFO;
	}

    public void addbook () throws IOException {
        System.out.println("Введите автора книги");
        BufferedReader d = new BufferedReader(new InputStreamReader(System.in, "windows-1251"));
String author = d.readLine();
 System.out.println("Введите название книги");
        BufferedReader k = new BufferedReader(new InputStreamReader(System.in, "windows-1251"));
String Name = k.readLine();
System.out.println("Введите допольнительную информацию о книге, например год издания");
BufferedReader m = new BufferedReader(new InputStreamReader(System.in, "windows-1251"));
String info = k.readLine();
    try {
 BufferedWriter out = new BufferedWriter(
  new OutputStreamWriter(
  new FileOutputStream("books\\"+author+" - "+Name)));
 out.write(info);
 out.newLine();
 out.close();
} catch (Exception e1) {
 e1.printStackTrace();
}
    }

    @Override
    public void execute(String... args) {
        throw new UnsupportedOperationException("Not supported yet.");
    }
    
}
